package com.syaccp.response;

import jdk.nashorn.internal.runtime.regexp.RegExp;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public  class PicturePath {
    /**
     * 项目获取图片路径前缀
     * */
    public static final String PICTURE_GET_PATH_PREFIX="https://api.hntututu.com/fullView/";

    /**
     * 项目获取图片路径连接
     * */
    public static final String CONNECT="/panos/";

    /**
     * 项目获取图片路径后缀
     * */
    public static final String PICTURE_GET_PATH_SUFFIX=".tiles/thumb.jpg";

    public static final String DEFAULT_PATH="";



    //项目截取路径方法
    public static String GET_PICTURE_GET_PATH(String picturePath){

        String PicturePath="";
        if(picturePath.contains("oss")==true){
            PicturePath=picturePath;
            return PicturePath;
        }



        if (picturePath.contains("_f.jpg")==true){
            String keyword =picturePath.replace("_f.jpg", "");
            PicturePath=PICTURE_GET_PATH_PREFIX+keyword+CONNECT+keyword+PICTURE_GET_PATH_SUFFIX;
        }else if (picturePath.contains("_f.jpg")==false){
//            PicturePath=DefaultPath;
            String keyword =picturePath.replace(".jpg", "");
            PicturePath=PICTURE_GET_PATH_PREFIX+keyword+CONNECT+keyword+PICTURE_GET_PATH_SUFFIX;
        }

        return PicturePath;

    }

    public static String GET_DEFAULT_PATH(){
        return DEFAULT_PATH;

    }

    public static List GET_ALBUM_PICS(String picPathList){
        List li=new ArrayList<>();
        if (picPathList.contains(",")==true){
            li = Arrays.asList(picPathList.split(","));
        }else {
            li.add(picPathList);
        }

        return li;
    }

}
